package com.atguigu.chaptar2

object $04_ControlAbstract {
  def main(args: Array[String]): Unit = {
    def m1(func: => Int) = {
      func
      func //控制抽象类型相当于无参函数的类型,所以func就相当于调用了无参函数,
      // 但因为无参,所以不能用()
    }
    var a = 0
  loop({
    a<10
  })({
    print(a)
    a=a+1
  })

  }
  def loop(condition: => Boolean)(block: => Unit):Unit = {
    if(condition){
      block
      loop(condition)(block)
    }
  }

}
